﻿using EFCORE仓储模式.Contracts;
using EFCORE仓储模式.Entites;
using Microsoft.EntityFrameworkCore;

namespace EFCORE仓储模式.Data.Repositories
{
    public class PlayerRepository : RepositoryBase<Player>, IPlayerRepository
    {
        public PlayerRepository(DataMangermentDbContext dbContext) : base(dbContext)
        {
        }

        public Task<List<Player>> GetAllPlayers()
        {
            return FindAll()
                .Include(x => x.Characters)
                .OrderBy(player => player.Id)
                .ToListAsync();
        }
    }
}